{% extends 'layout.html' %}
{% block content %}
<div class="card">
  <div class="header-row">
    <h2>客户管理</h2>
    <div>
      <a href="{{ url_for('add_customer') }}" class="btn primary">➕ 添加客户</a>
      <a href="{{ url_for('export_customers') }}" class="btn">📁 导出 CSV</a>
    </div>
  </div>
  <table class="table">
    <thead>
      <tr><th>编号</th><th>姓名</th><th>身份证</th><th>电话</th><th>地址</th><th>操作</th></tr>
    </thead>
    <tbody>
    {% for c in customers %}
      <tr>
        <td>{{ c.customerID }}</td><td>{{ c.customerName }}</td><td>{{ c.PID }}</td>
        <td>{{ c.telephone }}</td><td>{{ c.address }}</td>
        <td>
          <a href="{{ url_for('edit_customer', id=c.customerID) }}" class="btn small">编辑</a>
          <a href="{{ url_for('delete_customer', id=c.customerID) }}" class="btn small danger">删除</a>
        </td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
</div>
{% endblock %}
